#coding:utf-8
import os

#nmon_dir = 'D:\\pythonwork\\workspace\\NmonPy'
nmon_dir = 'c:\\'
i = 1
lists = os.listdir(nmon_dir)
print(lists)
#lists.sort(key=lambda fn: os.path.getmtime(nmon_dir + '\\' + fn))  # + "\\"
#System Volume Information文件判断失败
dir_list = sorted(lists, key=lambda x: os.path.getmtime(os.path.join(nmon_dir, x)))
print(dir_list)

for date in dir_list:
    print('i=', i)
    file_new = os.path.join(nmon_dir, dir_list[-i])
    if 'Result-20' in file_new and os.path.isdir(file_new):
        print(file_new)
        break
    else:
        i = i + 1
